#include<iostream>
#include <cstdio>
using namespace std;
int main ()
{
	double a,b;
	scanf("%lf %lf",&a,&b);
	int k=a/b;
	printf("%g",a-k*b);
	return 0;
}
